package com.xianxing.common.util;

import java.io.*;

import static io.lettuce.core.GeoArgs.Unit.m;

/**
 * 字符流转换String
 * Date 2020/3/5
 * Auth 李金全
 */
public class ConvertToStringUtil {

    public static String convertToString(InputStream stream)throws Exception{

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte[] buffer=new byte[1024];
        int len=0;
        while(((stream.read(buffer))!=-1)){
            out.write(buffer,0,len);
        }
        out.close();
        stream.close();
        return new String(out.toByteArray(),"UTF-8");
    }
}
